package com.cloud.conmmand;

import com.cloud.domain.TOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/7/1 22:30
 * @Desc
 * @Remarks
 */
@RestController
public class HystricCommandController {

    @Autowired
    RestTemplate restTemplate;

    @RequestMapping("/hystrix/command/test")
    public TOrder getOrder(Long id) throws Exception {
        OrderHystrixCommandService orderHystrixCommandService = new OrderHystrixCommandService(restTemplate, id);
        return orderHystrixCommandService.execute();
    }
}
